package com.dunqi.gpm.cangxi.develop.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.androidkun.xtablayout.XTabLayout;
import com.dunqi.gpm.cangxi.R;
import com.dunqi.gpm.cangxi.common.base.BaseFragment;
import com.dunqi.gpm.cangxi.common.view.ComTitleBar;
import com.dunqi.gpm.cangxi.home.adapter.ViewPagerFragmentAdapter;

import java.util.ArrayList;

import butterknife.BindView;

/**
 * Created by 空 on 2017/11/27 0027.
 */

public class DevelopFragment extends BaseFragment {

    @BindView(R.id.xTablayout)
    XTabLayout xTablayout;
    String[] titles = {"信息动态", "超期预警"};
    @BindView(R.id.view_pager)
    ViewPager viewPager;
    @BindView(R.id.title_bar)
    ComTitleBar titleBar;
    ArrayList<Fragment> fragments = new ArrayList<>();

    @Override
    protected void refreshData(Bundle savedInstanceState) {
    }

    @Override
    protected void initUiAndListener() {
        titleBar.setBackGone();
        fragments.add(new NewsDevelopFragment());
        fragments.add(new EarlyWarningFragment());
        viewPager.setAdapter(new ViewPagerFragmentAdapter(getChildFragmentManager(), fragments, titles));
        xTablayout.setupWithViewPager(viewPager);
    }

    @Override
    public boolean hasStateView() {
        return true;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_develop;
    }
}